function [Result] = Ddavid_MLkNN_with_distribution_features(AllDataTraining, AllDataTesting, DataSampler, SampledOnlyTrueLabelTraining, TrueLabelTesting, K, DistributionFeatures, FeatureUsingList)

% FeatureUsingList: UsingFeatureLabeledRank, UsingFeatureDensity, UsingFeatureCommonNeighbor

AllDataTraining2 = AllDataTraining;
AllDataTesting2 = AllDataTesting;
if(FeatureUsingList(1) == 1)
    AllDataTraining2 = [AllDataTraining2 DistributionFeatures.TrainingLabeledRanksTable];
    AllDataTesting2 = [AllDataTesting2 DistributionFeatures.TestingLabeledRanksTable];
end
if(FeatureUsingList(2) == 1)
    AllDataTraining2 = [AllDataTraining2 DistributionFeatures.TrainingDensityTable];
    AllDataTesting2 = [AllDataTesting2 DistributionFeatures.TestingDensityTable];
end
if(FeatureUsingList(3) == 1)
    AllDataTraining2 = [AllDataTraining2 DistributionFeatures.TrainingCommonNeighborTable];
    AllDataTesting2 = [AllDataTesting2 DistributionFeatures.TestingCommonNeighborTable];
end
SampledDataTraining2 = AllDataTraining2(DataSampler == 1, :);

[Result.Prior, Result.PriorN, Result.Cond, Result.CondN] = MLKNN_train(SampledDataTraining2, SampledOnlyTrueLabelTraining', K, 1);
[Result.HammingLoss, Result.RankingLoss, Result.OneError, Result.Coverage, Result.Average_Precision, Result.Outputs, Result.Pre_Labels] = MLKNN_test(SampledDataTraining2, SampledOnlyTrueLabelTraining', AllDataTesting2, TrueLabelTesting', K, Result.Prior, Result.PriorN, Result.Cond, Result.CondN);
